#pragma once

#include <iostream>
#include <iomanip>
#include <time.h>

template <class Benchmark>
void benchmark(const Benchmark & bm, size_t iIterCount)
{
    if(iIterCount == 0)
        throw std::runtime_error("Invalid iterations count specified");

    clock_t tStart = clock();
    for(size_t i=0; i<iIterCount; i++)
        bm.process();
    
    clock_t tFinish = clock();
    std::cout << std::setw(8) << ((double)(tFinish-tStart)) / (double)(CLOCKS_PER_SEC) * (double)1000000. / iIterCount << 
        " ns: " << bm.getBenchmarkName() << std::endl;
}
